import {
  IsArray,
  IsDate,
  IsNumber,
  IsOptional,
  IsString,
  ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { CreateBillingDetailsDto } from './create-mbillingdetail.dto';

export class CreateMbillDto {
  @IsString()
  customername: string;

  @IsDate()
  @Type(() => Date)
  Date: Date;

  @IsNumber()
  totalOrderMoney: number;

  @IsNumber()
  @IsOptional()
  ReceivedAmount?: number;

  @IsString()
  @IsOptional()
  OrderRemarks?: string;

  @IsString()
  ordernumber: string;

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => CreateBillingDetailsDto)
  list: CreateBillingDetailsDto[];
}
